From 969807247dfa7d57cecd79fcd5a1dc4207e82614 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 25 Jul 2005 21:02:50 +0000 Subject: [PATCH] Restore command line parsing code from qemu-0.6.1 This enables cdrom ejection (both file based and physical i.e. /dev/cdrom) Signed-off-by: Edwin Zhai Signed-off-by: Arun Sharma --- tools/ioemu/monitor.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/tools/ioemu/monitor.c b/tools/ioemu/monitor.c index ea3bc28280..677f9b6d85 100644 --- a/tools/ioemu/monitor.c +++ b/tools/ioemu/monitor.c @@ -514,21 +514,45 @@ static void monitor_handle_command(const char *cmdline) str_allocated[nb_args] = str; add_str: if (nb_args >= MAX_ARGS) { -#if 0 error_args: -#endif term_printf("%s: too many arguments\n", cmdname); goto fail; } args[nb_args++] = str; } break; + case '-': + { + int has_option; + /* option */ + + c = *typestr++; + if (c == '\0') + goto bad_type; + while (isspace(*p)) + p++; + has_option = 0; + if (*p == '-') { + p++; + if (*p != c) { + term_printf("%s: unsupported option -%c\n", + cmdname, *p); + goto fail; + } + p++; + has_option = 1; + } + if (nb_args >= MAX_ARGS) + goto error_args; + args[nb_args++] = (void *)has_option; + } + break; /* TODO: add more commands we need here to support vmx device model */ case '/': case 'i': - case '-': default: - term_printf("%s: unknown type '%c', we only support quit command now.\n", cmdname, c); + bad_type: + term_printf("%s: unknown type '%c',not support now.\n", cmdname, c); goto fail; } } -- 2.30.2